<template>
    <div class="home">
        <leftnavs @sent-listnum="getlistnum" @clear-listnum="clearlistnum"></leftnavs>
        
        <div class="right" :style="{ transform: `translateX(${moveX}px)`}">
            <div class="righttop">
                <el-breadcrumb separator-class="el-icon-arrow-right">
                    <el-breadcrumb-item :to="{ path: '/' }">当前位置</el-breadcrumb-item>
                    <el-breadcrumb-item>首页</el-breadcrumb-item>
                    
                </el-breadcrumb>
                <div class="top-rightbox">
                    <div>
                        <img src="../assets/topone.svg" alt="">
                        <span>提醒</span>
                    </div>
                    <div>
                        <img src="../assets/toptwo.svg" alt="">
                        <span>帮助</span>
                    </div>
                </div>
            </div>
            <div class="rightlist">
                <div class="addshop">
                    <span>发布商品</span>
                </div>
                <div class="searchlist">
                    
                    <div class="searchtwo">
                        <span class="classifyname">商品类目</span>
                        <div class="selectbox">
                            <el-select  v-model="value" placeholder="请选择">
                                <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </div>
                    </div>
                    <div class="searchthree">
                        <span class="classifyname">创建日期</span>
                        <div class="datebox">
                            <el-date-picker
                                v-model="value"
                                type="daterange"
                                start-placeholder="开始日期"
                                end-placeholder="结束日期"
                                :default-time="['00:00:00', '23:59:59']">
                            </el-date-picker>
                        </div>
                    </div>
                    <div class="searchfour">
                        <div class="searchone">
                            <span class="classifyname">商品名称</span>
                            <div class="shopnamebox">
                            <input type="text" placeholder="商品名称/条码/编码">
                        </div>
                    <div class="searchbutton">
                        <img src="../assets/search.svg" alt="">
                        <span>查询</span>
                    </div>
                        
                    </div>
                    </div>
                </div>

                <div class="midclassify">
                    <div v-for="(item,index) in midclassify" :key="index" :class="{ 'midclassifyone': true, 'midclassifyactive': index == checknum }"  @click="getdata(index)">{{item}}</div>
                </div>
                <div class="midlinebox"></div>

                <div class="shoplist">
                    <el-table
                        ref="multipleTable" 
                        :data="tableData"
                        tooltip-effect="dark"
                        style="width: 100%"
                        @selection-change="handleSelectionChange">
                        <el-table-column
                        type="selection"
                        width="55">
                        </el-table-column>
                        <el-table-column
                        prop="date"
                        label="日期"
                        sortable
                        width="120">
                        </el-table-column>
                        <el-table-column
                        prop="visitnum"
                        label='访问量'
                        sortable
                        width="120">
                        </el-table-column>
                        <el-table-column
                        prop="name"
                        label="姓名"
                        width="80">
                        </el-table-column>
                        <el-table-column
                        prop="wtgroup"
                        label="所属分组"
                        width="60">
                        </el-table-column>
                        <el-table-column
                        prop="address"
                        label="地址"
                        show-overflow-tooltip>
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button
                                size="mini"
                                @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                                <span style="color: #0099ff">-</span>
                                <el-button
                                size="mini"
                                
                                @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </div>

                <div class="listbottom">
                    <div class="blockleft">
                        <div class="changeclassify">改分组</div>
                        <div class="changedown">下架</div>
                        <div class="changedel">删除</div>
                    </div>
                    <div class="block">
                        <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="currentPage4"
                        :page-sizes="[100, 200, 300, 400]"
                        :page-size="100"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="400">
                        </el-pagination>
                    </div>
                </div>

            </div>
            
        </div>
        
    </div>
    </template>
    
    <script>
    // @ is an alias to /src
    import HelloWorld from '@/components/HelloWorld.vue'
import Leftnavs from '@/components/Leftnavs.vue';
    import Small from '@/components/Small.vue'
    
    import * as echarts from 'echarts'
    export default {
      name: 'HomeView',
      
      components: {
        HelloWorld,
        Small,
        Leftnavs,

      },
      data(){
        return{
            checknum:-1,
            chart:null,
            listnum:0,
            value: '',
            currentPage4: 1,
            midclassify: ['全部','销售中','仓库中','已售罄',],
            tableData: [{
          date: '2016-05-03',
          name: '王小',
          address: '上海市普陀区金沙江路 1518 弄',
          shopname: '香蕉',
          shopclassify: '水果',
          status: '正常',
          visitnum: 100,
          salenum: 1000,
          wtgroup: '',
        },  {
            date: '2016-05-03',
          name: '小虎',
          address: '北京市海淀区西二旗',
          shopname: '香蕉',
          shopclassify: '水果',
          status: '正常',
          visitnum: 100,
          salenum: 1000,
          wtgroup: '',
        }, {
        date: '2016-05-03',
          name: '王小虎',
          address: '上海市浦东新区',
          shopname: '香蕉',
          shopclassify: '水果',
          status: '正常',
          visitnum: 100,
          salenum: 1000,
          wtgroup: '',
        }, {
            date: '2016-05-03',
          name: '王虎',
          address: '上海市浦东新区',
          shopname: '香蕉',
          shopclassify: '水果',
          status: '正常',
          visitnum: 100,
          salenum: 1000,
          wtgroup: '',
        }, {
            date: '2016-05-03',
          name: '王小',
          address: '北京市海淀区西二旗金沙江路 1518 弄',
          shopname: '香蕉',
          shopclassify: '水果',
          status: '正常',
          visitnum: 100,
          salenum: 1000,
          wtgroup: '',
        }, {
            date: '2016-05-03',
          name: '小虎',
          address: '北京市海淀区西二旗路 1518 弄',
          shopname: '香蕉',
          shopclassify: '水果',
          status: '正常',
          visitnum: 100,
          salenum: 1000,
          wtgroup: '',
        }, {
            date: '2016-05-03',
          name: '王虎',
          address: '上海市浦东新区 1518 弄',
          shopname: '香蕉',
          shopclassify: '水果',
          status: '正常',
          visitnum: 100,
          salenum: 1000,
          wtgroup: '',
        }],
        multipleSelection: [],
            options: [{
                value: '选项1',
                label: '蔬菜'
                }, {
                value: '选项2',
                label: '水果'
                },],
                value: '',
                dates: [{
                value: '选项1',
                label: '正常'
                }, {
                value: '选项2',
                label: '淘汰'
                },],
        }
      },
     
      methods:{
        getlistnum(data){
            this.listnum=data
            console.log(this.listnum);
            
        },
        clearlistnum(){
            this.listnum=0
            console.log(this.listnum);
            
        },
        dellistnum(){
            this.listnum=0
        },
        gonext(data){
            if(this.$route.name!=data){
				this.$router.push({name:data})
			}else{
				console.log('出错了');
			}
        },
        getdata(i){
            console.log(i);
            
            this.checknum=i
        },
		rehome(){
			if(this.$route.name!='home'){
				this.$router.push({name:'home'})
				
			}else{
				console.log('已经在主页了');
				
			}
  		},
        handleSelectionChange() {
           console.log(23);
           
        },
        handleSizeChange(size) {
            console.log(`每页 ${size} 条`);
        },
        handleCurrentChange(currentPage) {
            console.log(`当前页: ${currentPage}`);
        },
        handleEdit(index, row) {
            console.log(index, row);
        },
        handleDelete(index, row) {
            console.log(index, row);
        },
        handleDelete(index, row) {
            console.log(index, row);
        },
        handleDelete(index, row) {
            console.log(index, row);
        },
        
      },
      computed: {
        moveX() {
          return this.listnum >= 1 ? 115 : 0;
        },
      },
      
    
    }
    </script>
    <style scoped>
    *{
        padding: 0;
        margin: 0;
    }
    li{
        cursor: pointer;
    }
    .left{
        height: auto;
        width: 98px;
        background-color: rgb(0, 21, 41);	
    }
    ul{
        list-style: none;
        
    }
    .myphoto img{
        width: 48px;
        height: 48px;
        border-radius: 50%;
    }
    .myphoto{
        padding: 18px;
    }
    li img{
        height: 18px;
        margin-left: 13px;
        width: auto;
    }
    .right{
        transition:  all .8s;
    }
    .othersvg{
        width: 18px !important;
        height: auto;
    }
    li{
        display: flex;
        align-items: center;
        height: 44px;
    }
    
    li span{
        display: block;
        float: right;
        margin-left: 20px;
        font-size: 13px;
        color: rgb(228, 228, 228);
        font-weight: 400;
    }
    .morewith{
        padding-right: 2.5px;
        padding-left: 2.5px;
    }
    .righttop{
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 1260px;
        height: 36px;
        background-color: rgb(255, 255, 255);
        border: none;
        border-radius: 0px;
        box-shadow: rgba(0, 0, 0, 0.35) 0px 0px 5px;
    }
    .home{
        display: flex;
        margin: 0 auto;
        width: 1360px;
        margin: 0 auto;
    }
    .el-breadcrumb{
        margin-left: 10px;
    }
    .top-rightbox{
        
        color: #555;
        display: flex;
        align-items: center;
    }
    .top-rightbox div{
        font-size: 14px;
        margin-right: 15px;
        color: #555;
        display: flex;
        align-items: center;
    }
    .top-rightbox div img{
        margin-right: 5px;
    }
    .botonebox{
        display: flex;
    }

    .botline{
        width: 1227px;
        height: 429px;
        background: inherit;
        background-color: rgba(255, 255, 255, 1);
        border: none;
        border-radius: 0px;
        margin-left: 35px;
        margin-top: 20px;
    }
    .classify{
        z-index: 99;
        position: absolute;
        left: 142px;
        top: 0;
        width: 114px;
        height: 823px;
        background: inherit;
        background-color: rgba(255, 255, 255, 1);
        border: none;
        border-radius: 0px;
    }
    .shopreturn img{
        margin-left: 20px;
    }
    .shopreturn{
        height: 38px;
        line-height: 38px;
        border-bottom:1.5px solid #cfcfcf;
        font-size: 13px;
    } 
    .shopul li{
        padding-left: 19px;
        font-size: 13px;
    }
    .shopul{
        margin-top: 5px;
    }

    .addshop{
        width: 91px;
        height: 30px;
        background: inherit;
        background-color: rgba(0, 153, 255, 1);
        border: none;
        border-radius: 2px;
        font-weight: 400;
        font-style: normal;
        font-size: 12px;
        color: #fff;
    }
    .addshop span{
        line-height: 30px;
    }
    .rightlist{
        margin-left: 10px;
        margin-top: 13px;
        /* background-color: #fff; */
        padding: 20px 10px 0 18px;
    }
    .searchlist{
        background-color: #f4f9fa;
        width: 1220px;
        margin-top: 16px;
        height: 61px;
        display: flex;
        flex-wrap: wrap;
    }
    .searchone{
        display: flex;
        align-items: center;
    }
    .shopnamebox{
        padding: 5px 7px;
        border: 1px solid #555;
        background-color: #fff;
    }
    .shopnamebox input{
        border: none;
        outline: none;
    }
    .searchtwo{
        display: flex;
        align-items: center;
    }
    .searchthree{
        display: flex;
        align-items: center;
    }
    .searchfour{
        display: flex;
        align-items: center;
    }
    .searchbutton{
        width: 80px;
        height: 30px;
        background: inherit;
        background-color: rgba(0, 153, 255, 1);
        border: none;
        border-radius: 2px;
        font-weight: 400;
        font-style: normal;
        font-size: 13px;
        display: flex;
        align-items: center;
        color: #fff;
        /* margin-left: 64px; */
    }
    .searchbutton img{
        width: 13px;
        height: 13px;
        margin-left: 16px;
        margin-right: 8px;
    }
    .midclassify{
        width: 400px;
        background: inherit;
        background-color: rgba(255, 255, 255, 1);
        border: none;
        line-height: 30px;
        font-size: 13px;
        color: #222;
        text-align: center;
        display: flex;
        margin-top: 35px;
    }
    .midclassify div{
        width: 100px;
        height: 30px;
        cursor: pointer;
    }
    .midlinebox{
        width: 1222px;
        height: 2px;
        background-color: #0079fe;
        margin-bottom: 35px;
    }
    .listbottom{
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .blockleft{
        display: flex;
        align-items: center;
    }
    .blockleft div{
        width: 78px;
        height: 30px;
        background: inherit;
        background-color: rgba(255, 255, 255, 1);
        box-sizing: border-box;
        border-width: 1px;
        border-style: solid;
        border-color: rgba(204, 204, 204, 1);
        border-radius: 2px;
        cursor: pointer;
        margin-right: 10px;
        font-size: 13px;
        color: #555;
        line-height: 30px;
    }
    .changeclassify{
        margin-right: 10px;
    }
    .midclassifyactive{
        color: #ffffff;
        background-color: #0079fe;
    }
    .midclassifyone{
        width: 100px;
        height: 30px;
        cursor: pointer;
        margin-right: 10px;
    }
    .midclassifyone:hover{
        color: #0079fe;
    }
    ::v-deep .el-input__inner  {
        height: 30px;
        line-height: 30px; /* 确保文本垂直居中 */
    }
    
/* 同理，调整下拉箭头的大小和位置 */
    ::v-deep .el-select .el-input__icon {
    line-height: 30px; /* 确保下拉箭头垂直居中 */
    }
    ::v-deep .el-icon-date {
    line-height: 22px; /* 确保下拉箭头垂直居中 */
    }
    ::v-deep .el-range-separator{
        line-height: 22px;
    }
    ::v-deep .el-range__close-icon{
        line-height: 22px;
    }
    ::v-deep .el-select{
        width: 200px;
    }
    ::v-deep .el-date-editor{
        width: 200px;
    }
    ::v-deep .el-button{
        border: 0;
        margin-left: 5px;
        margin-right: 5px;
        color: #0099ff;
    }
    .searchlistbox{
        display: flex;
        flex-wrap: wrap;
        max-width: 1150px;
        padding-left: 10px;
    }
    .classifyname{
        font-size: 14px;
        margin-right: 10px
    }
    ::v-deep .el-table__header-wrapper{
        border-color: rgba(204, 204, 204, 1);
        border-width: 1px;
        border-style: solid;
        border-left: 0px;
        border-right: 0px;
       
    }
    ::v-deep .el-table th {
        
        background-color: #f2f2f2;
    }
    ::v-deep .cell{
        line-height: 1;
    }
    ::v-deep .el-table th.el-table__cell>.cell{
        padding-left: 14px;
    }
    </style>